Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: optimize getFileCommitDate, make it async #9890

Merged
merged 1 commit into from
Feb 24, 2024

Conversation

slorber
Copy link
Collaborator

@slorber slorber commented Feb 24, 2024

Motivation

getFileCommitDate() has been identified as a strong sync IO bottleneck of the loadContent blog and docs lifecycle hooks.

Making it async greatly optimizes the time it takes to call loadContent on all plugins. This only affects the production build because getFileCommitDate() was already bypassed in dev mode.

Local benchmark

yarn clear:website && yarn build:website --locale en

Before:

  • loadContent: 17s
  • Total build time: 84s

After: 🔥

  • loadContent: 1.2s
  • Total build time: 68s

Test Plan

unit tests + CI

Test links

https://deploy-preview-9890--docusaurus-2.netlify.app/

@slorber slorber added pr: performance This PR does not add a new behavior, but existing behaviors will be more memory- / time-efficient. to backport This PR is planned to be backported to a stable version of Docusaurus labels Feb 24, 2024
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Feb 24, 2024
@slorber slorber added the Argos Add this label to run UI visual regression tests. See argos.yml GH action. label Feb 24, 2024
packages/docusaurus-utils/src/gitUtils.ts Dismissed Show dismissed Hide dismissed
Copy link

netlify bot commented Feb 24, 2024

[V2]

Name Link
🔨 Latest commit 0da5877
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/65da3c97f6a7d70008714502
😎 Deploy Preview https://deploy-preview-9890--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO PWA Report
/ 🟠 74 🟢 98 🟢 96 🟢 100 🟠 88 Report
/docs/installation 🟠 83 🟢 96 🟢 100 🟢 100 🟠 88 Report
/docs/category/getting-started 🟠 75 🟢 100 🟢 100 🟢 90 🟠 88 Report
/blog 🟠 71 🟢 100 🟢 100 🟢 90 🟠 88 Report
/blog/preparing-your-site-for-docusaurus-v3 🟠 63 🟢 96 🟢 100 🟢 100 🟠 88 Report
/blog/tags/release 🟠 71 🟢 100 🟢 100 🟠 80 🟠 88 Report
/blog/tags 🟠 76 🟢 100 🟢 100 🟢 90 🟠 88 Report

Copy link

argos-ci bot commented Feb 24, 2024

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ✅ No change detected - Feb 24, 2024, 7:08 PM

Copy link

Size Change: 0 B

Total Size: 992 kB

ℹ️ View Unchanged
Filename Size
website/.docusaurus/globalData.json 75.4 kB
website/build/assets/css/styles.********.css 114 kB
website/build/assets/js/main.********.js 765 kB
website/build/index.html 37.9 kB

compressed-size-action

@slorber slorber merged commit f159bb2 into main Feb 24, 2024
34 checks passed
@slorber slorber deleted the slorber/optimize-get-commit-date-sync branch February 24, 2024 22:32
OzakIOne added a commit that referenced this pull request Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Argos Add this label to run UI visual regression tests. See argos.yml GH action. CLA Signed Signed Facebook CLA pr: performance This PR does not add a new behavior, but existing behaviors will be more memory- / time-efficient. to backport This PR is planned to be backported to a stable version of Docusaurus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants